home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / MPW Oberon 2.1168 / OExamples / DAMemory.r < prev    next >
Encoding:
Text File  |  1994-11-02  |  2.3 KB  |  83 lines  |  [TEXT/MPS ]

  1. /*
  2.  * File DAMemory.r
  3.  *
  4.  * Copyright Apple Computer, Inc. 1985-1987
  5.  * All rights reserved.
  6.  *
  7.  * Sample desk accessory resource file.
  8.  * This incorporates the DRVR header information (defined here)
  9.  * with the linked code (stored as a 'DRVW' resource in the link command)
  10.  */
  11.  
  12. #include "Types.r"                /* To get system types */
  13. #include "MPWTypes.r"            /* To get 'DRVW' type */
  14.  
  15. #define DriverID    12
  16.  
  17. #ifdef NOASM_BUILD
  18. /*
  19.  * This will produce a DRVR resource from the special DRVW type.
  20.  *
  21.  * Note that the ID 12 is irrelevant, since the Font/DA Mover
  22.  * will renumber it to something else when installing it anyway.
  23.  *
  24.  * The leading NUL in the resource name is required to
  25.  * conform to the desk accessory naming convention.
  26.  *
  27.  * The resource is declared purgeable.    If the code were to
  28.  * do funky things like SetTrapAddress calls (requiring the code to
  29.  * be around at all times), we would have to set it nonpurgeable.
  30.  */
  31.  
  32. type 'DRVR' as 'DRVW';            /* Map 'DRVW' => 'DRVR' */
  33.  
  34. resource 'DRVR' (DriverID, "\0x00DAMemory", purgeable) {
  35.     /*
  36.      * DRVR flags
  37.      */
  38.     dontNeedLock,            /* OK to float around, not saving ProcPtrs */
  39.     needTime,                /* Yes, give us periodic Control calls */
  40.     dontNeedGoodbye,        /* No special requirements */
  41.     noStatusEnable,
  42.     ctlEnable,                /* Desk accessories only do Control calls */
  43.     noWriteEnable,
  44.     noReadEnable,
  45.     5*60,                    /* drvrDelay - Wake up every 5 seconds */
  46.     updateMask,             /* drvrEMask - This DA only handles update events */
  47.     0,                        /* drvrMenu - This DA has no menu */
  48.     "DAMemory",                /* drvrName - This isn't used by the DA */
  49.     /*
  50.      * This directive inserts the contents of the DRVW resource
  51.      * produced by linking DRVRRuntime.o with our DA code
  52.      */
  53.     $$resource("DAMemory.DRVW", 'DRVW', 0)
  54. };
  55. #endif
  56.  
  57. /*
  58.  * Since desk accessories cannot use global data (and the C compiler
  59.  * considers string constants to be global data) and we really don't
  60.  * want to hard-code strings in our source, the strings used by the 
  61.  * DA are stored in the resource file. Note the expression used to
  62.  * figure out the resource id.
  63.  */
  64.  
  65. resource 'STR#' (0xC000 | (DriverID << 5), "DAMemory's Strings") {
  66.     {
  67.         "AppHeap: ";
  68.         "  SysHeap: ";
  69.         "  Disk: ";
  70.         " free on "
  71.     };
  72. };
  73.  
  74.  
  75. resource 'WIND' (0xC000 | (DriverID << 5), "DAMemory's Window") {
  76.     {322, 10, 338, 500},
  77.     noGrowDocProc,
  78.     visible,
  79.     goAway,
  80.     0x0,
  81.     "Free Memory (# Bytes)"
  82. };
  83.